/*
 Navicat Premium Data Transfer

 Source Server         : localhost
 Source Server Type    : MySQL
 Source Server Version : 50624
 Source Host           : localhost
 Source Database       : ulink_plus

 Target Server Type    : MySQL
 Target Server Version : 50624
 File Encoding         : utf-8

 Date: 06/26/2019 22:41:09 PM
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
--  Table structure for `PDMAN_DB_VERSION`
-- ----------------------------
DROP TABLE IF EXISTS `PDMAN_DB_VERSION`;
CREATE TABLE `PDMAN_DB_VERSION` (
  `DB_VERSION` varchar(256) COLLATE utf8_bin DEFAULT NULL,
  `VERSION_DESC` varchar(1024) COLLATE utf8_bin DEFAULT NULL,
  `CREATED_TIME` varchar(32) COLLATE utf8_bin DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

-- ----------------------------
--  Records of `PDMAN_DB_VERSION`
-- ----------------------------
BEGIN;
INSERT INTO `PDMAN_DB_VERSION` VALUES ('v1.0.0', '初始化', '2019-01-10 15:30:10'), ('v1.0.1', '修改', '2019-01-10 15:34:31');
COMMIT;

-- ----------------------------
--  Table structure for `ue_admin_user`
-- ----------------------------
DROP TABLE IF EXISTS `ue_admin_user`;
CREATE TABLE `ue_admin_user` (
  `id` varchar(32) COLLATE utf8_bin NOT NULL COMMENT 'id',
  `login_name` varchar(128) COLLATE utf8_bin DEFAULT NULL COMMENT '登录名',
  `password` varchar(128) COLLATE utf8_bin DEFAULT NULL COMMENT '密码',
  `name` varchar(128) COLLATE utf8_bin DEFAULT NULL COMMENT '名称',
  `mch_no` varchar(128) COLLATE utf8_bin DEFAULT NULL COMMENT '所属商户',
  `is_datafilter` bit(1) DEFAULT NULL COMMENT '是否过滤数据',
  `filter_store_ids` varchar(3120) COLLATE utf8_bin DEFAULT NULL COMMENT '门店属性 用","分割',
  `type` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '用户类型 SUPPERADMIN,ADMIN,PUBLIC',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='商户后台用户';

-- ----------------------------
--  Table structure for `ue_app_token`
-- ----------------------------
DROP TABLE IF EXISTS `ue_app_token`;
CREATE TABLE `ue_app_token` (
  `app_key` varchar(32) COLLATE utf8_bin NOT NULL COMMENT '应用key',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `auth_type` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '验证类型 SIGN,TOKEN',
  `app_secret` varchar(128) COLLATE utf8_bin DEFAULT NULL COMMENT '密钥',
  `app_token` varchar(128) COLLATE utf8_bin DEFAULT NULL COMMENT 'token',
  PRIMARY KEY (`app_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='应用密钥';

-- ----------------------------
--  Table structure for `ue_channel_account`
-- ----------------------------
DROP TABLE IF EXISTS `ue_channel_account`;
CREATE TABLE `ue_channel_account` (
  `account_id` varchar(32) COLLATE utf8_bin NOT NULL COMMENT 'account_id 商户号+渠道类型+渠道ID',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `mch_no` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '商户号',
  `channel_type` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '渠道类型',
  `channel_id` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '渠道ID 支付宝是appid(考虑是否用支付宝帐号)；微信，建行，农行，工行，银联，银联商务都是商户号',
  `content` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '配置内容JSON',
  PRIMARY KEY (`account_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='渠道收款账号';

-- ----------------------------
--  Table structure for `ue_mch_info`
-- ----------------------------
DROP TABLE IF EXISTS `ue_mch_info`;
CREATE TABLE `ue_mch_info` (
  `mch_no` varchar(32) COLLATE utf8_bin NOT NULL COMMENT '商户号',
  `mch_name` varchar(128) COLLATE utf8_bin DEFAULT NULL COMMENT '商户名称',
  `mch_area` varchar(1024) COLLATE utf8_bin DEFAULT NULL COMMENT '地区',
  `mch_hy` varchar(1024) COLLATE utf8_bin DEFAULT NULL COMMENT '行业',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`mch_no`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='商户信息';

-- ----------------------------
--  Records of `ue_mch_info`
-- ----------------------------
BEGIN;
INSERT INTO `ue_mch_info` VALUES ('1001', '测试商户', '11', '11', '2019-06-26 22:27:59', '2019-06-26 22:28:01');
COMMIT;

-- ----------------------------
--  Table structure for `ue_mch_product`
-- ----------------------------
DROP TABLE IF EXISTS `ue_mch_product`;
CREATE TABLE `ue_mch_product` (
  `id` varchar(32) COLLATE utf8_bin NOT NULL COMMENT 'id',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `mch_no` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '商户号',
  `product_code` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '产品编码',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='商户已开通产品';

-- ----------------------------
--  Table structure for `ue_mch_scene`
-- ----------------------------
DROP TABLE IF EXISTS `ue_mch_scene`;
CREATE TABLE `ue_mch_scene` (
  `scene_id` varchar(32) COLLATE utf8_bin NOT NULL COMMENT '场景ID',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `mch_no` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '商户号',
  `name` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '名称',
  `memo` varchar(1024) COLLATE utf8_bin DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`scene_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='商户场景;';

-- ----------------------------
--  Table structure for `ue_product`
-- ----------------------------
DROP TABLE IF EXISTS `ue_product`;
CREATE TABLE `ue_product` (
  `id` varchar(32) COLLATE utf8_bin NOT NULL COMMENT 'id',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `product_code` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '产品编码',
  `product_name` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '产品名称',
  `product_icon` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '产品ICON',
  `product_desc` text COLLATE utf8_bin COMMENT '产品介绍',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='产品信息';

-- ----------------------------
--  Table structure for `ue_refund_order`
-- ----------------------------
DROP TABLE IF EXISTS `ue_refund_order`;
CREATE TABLE `ue_refund_order` (
  `refund_no` varchar(32) COLLATE utf8_bin NOT NULL COMMENT '退款号',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `trade_no` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '交易订单号',
  `channel_refund_no` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '渠道退款号',
  `mch_no` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '商户号',
  `store_no` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '门店号 空，填默认门店',
  `account_id` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '收款账号ID',
  `scene_id` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '场景ID',
  `refund_time` datetime DEFAULT NULL COMMENT '退款时间',
  `paid_time` datetime DEFAULT NULL COMMENT '付款时间',
  `refund_amount` int(11) DEFAULT NULL COMMENT '退款金额（分）',
  `refund_reason` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '退款原因',
  `refund_status` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '退款状态 退款状体：REFUND_WAITING:正在提交退款，REFUND_SUCCESS:退款提交成功,REFUND_FAILED:退款失败，REFUND_FINISHED:退款成功，REFUND_CHANGE:退款无法到账，需要人工介入',
  `check_status` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '订单核对状态',
  `error_msg` text COLLATE utf8_bin COMMENT '错误信息',
  `txn_time` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '时间戳 银联用',
  PRIMARY KEY (`refund_no`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='退款单';

-- ----------------------------
--  Table structure for `ue_store_info`
-- ----------------------------
DROP TABLE IF EXISTS `ue_store_info`;
CREATE TABLE `ue_store_info` (
  `store_no` varchar(32) COLLATE utf8_bin NOT NULL COMMENT '门店号',
  `mch_no` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '所属商户号',
  `store_name` varchar(128) COLLATE utf8_bin DEFAULT NULL COMMENT '门店名称',
  `store_address` varchar(3120) COLLATE utf8_bin DEFAULT NULL COMMENT '详细地址',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`store_no`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='门店信息';

-- ----------------------------
--  Table structure for `ue_trade_order`
-- ----------------------------
DROP TABLE IF EXISTS `ue_trade_order`;
CREATE TABLE `ue_trade_order` (
  `trade_no` varchar(32) COLLATE utf8_bin NOT NULL COMMENT '交易号',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `trade_date` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '账期yyyy-MM-dd',
  `title` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '订单名称',
  `amount` int(11) DEFAULT NULL COMMENT '金额（分）',
  `expire_time` datetime DEFAULT NULL COMMENT '过期时间',
  `memo` varchar(1024) COLLATE utf8_bin DEFAULT NULL COMMENT '备注',
  `pay_channel` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '付款渠道',
  `pay_method` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '付款方式 deposit,wxjsapi,aliqrcode...',
  `channel_trade_no` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '渠道交易号',
  `account_id` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '收款账号ID',
  `mch_no` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '商户号',
  `store_no` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '门店号 空，用默认门店',
  `scene_id` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '场景id',
  `payer` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '付款人',
  `payment_time` datetime DEFAULT NULL COMMENT '付款时间',
  `trade_status` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '交易状态',
  `is_paid` bit(1) DEFAULT NULL COMMENT '是否已付款',
  `is_closed` bit(1) DEFAULT NULL COMMENT '是否已关闭',
  `is_refund` bit(1) DEFAULT NULL COMMENT '是否已退款',
  `refund_status` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '退款状态',
  `notify_url` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '回调通知地址',
  `return_url` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '页面返回地址',
  `check_status` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '渠道核对状态',
  `error_msg` text COLLATE utf8_bin COMMENT '错误信息',
  `attach` varchar(1024) COLLATE utf8_bin DEFAULT NULL COMMENT '扩展信息',
  `qr_code` varchar(1024) COLLATE utf8_bin DEFAULT NULL COMMENT '二维码信息',
  `auth_code` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '付款码信息',
  `txn_time` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '交易时间戳yyyyMMddHHmmss 银联使用',
  PRIMARY KEY (`trade_no`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='付款单';

SET FOREIGN_KEY_CHECKS = 1;
